package com.iplant.aps.service.mesenum;

import com.iplant.aps.service.po.cfg.CFGItem;

import java.util.ArrayList;
import java.util.List;

/**
 * 订单类型
 */
public enum OMSOrderLessQuestionType {
    /**
     * 默认
     */
    Default(0, "默认"),
    /**
     * 返修
     */
    Repair(1, "返修"),
    /**
     * 不合格评审
     */
    UnqualifiedReview(2, "不合格评审");

    private final int value;
    private final String lable;

    OMSOrderLessQuestionType(int value, String lable) {
        this.value = value;
        this.lable = lable;
    }

    /**
     * 通过 value 的数值获取枚举实例
     */
    public static OMSOrderLessQuestionType getEnumType(int val) {
        for (OMSOrderLessQuestionType type : OMSOrderLessQuestionType.values()) {
            if (type.getValue() == val) {
                return type;
            }
        }
        return Default;
    }

    public static List<CFGItem> getEnumList() {
        List<CFGItem> wItemList = new ArrayList<>();

        for (OMSOrderLessQuestionType type : OMSOrderLessQuestionType.values()) {
            CFGItem wItem = new CFGItem();
            wItem.ID = type.getValue();
            wItem.ItemName = type.getLable();
            wItem.ItemText = type.getLable();
            wItemList.add(wItem);
        }
        return wItemList;
    }

    public int getValue() {
        return value;
    }

    public String getLable() {
        return lable;
    }
}
